package com.example.sofa_module.picturesofa;

import android.widget.ImageView;

import com.bw.adapter_sdk.quick.BaseQuickAdapter;
import com.bw.adapter_sdk.quick.BaseViewHolder;
import com.bw.network_sdk.videoentity.VideoValuesEntity;
import com.bw.sofa_module.R;

public class PictureAdapter extends BaseQuickAdapter<VideoValuesEntity> {
    public PictureAdapter() {
        super(R.layout.item_picture);
        addItemChildClick(R.id.item_picture_likes_img,
                R.id.item_picture_unlikes_img);
    }

    @Override
    public void convert(BaseViewHolder holder, VideoValuesEntity item) {
        holder.setText(R.id.item_picture_artist,item.author.name);
        holder.setText(R.id.item_picture_content,item.feeds_text);
        holder.setText(R.id.item_picture_likes_count,item.ugc.likeCount+"");
        holder.setText(R.id.item_picture_share_count,item.ugc.shareCount+"");
        holder.setText(R.id.item_picture_comment_count,item.ugc.commentCount+"");

        holder.setCirImage(R.id.item_picture_artist_img,item.author.avatar);
        holder.setImage(R.id.item_picture_bigimg,item.cover);

        ImageView image_like = holder.getView(R.id.item_picture_likes_img);
        ImageView image_diss = holder.getView(R.id.item_picture_unlikes_img);

        if (item.ugc.hasLiked)
            image_like.setImageResource(R.drawable.icon_cell_liked);
        else
            image_like.setImageResource(R.drawable.icon_cell_like);

        if (item.ugc.hasdiss)
            image_diss.setImageResource(R.drawable.icon_cell_dissed);
        else
            image_diss.setImageResource(R.drawable.icon_cell_diss);
    }
}
